//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __CHANNEL_COMMAND_H__
#define __CHANNEL_COMMAND_H__

#include "ChannelData.h"

class ChannelCommand : public ChannelData
{
public:
    static const unsigned int TYPE_CREATE = 1;
    static const unsigned int TYPE_REPLY = 2;
    static const unsigned int TYPE_DELETE = 3;
    static const unsigned int TYPE_RESET = 4;

public:
    ChannelCommand();
    ChannelCommand(ChannelData *data);
    ChannelCommand(const ChannelCommand& cmd);
    ChannelCommand(unsigned int command);
    ChannelCommand(unsigned int channel,
            unsigned int command);
    ChannelCommand(unsigned int channel,
            unsigned int command, unsigned int property);
    virtual ~ChannelCommand();

    unsigned int GetCommand() const
    {
        return ReadInteger(m_data);
    }
    inline void SetCommand(unsigned int command)
    {
        WriteInteger(m_data, command);
    }
    unsigned int GetChannel() const
    {
        return ReadInteger((char*) m_data + 4);
    }
    void SetChannel(unsigned int channel)
    {
        WriteInteger((char*) m_data + 4, channel);
    }
    inline unsigned int GetProperty() const
    {
        return ReadInteger((char*) m_data + 8);
    }
    void SetProperty(unsigned int property)
    {
        WriteInteger((char*) m_data + 8, property);
    }
};

#endif //__CHANNEL_COMMAND_H__
